feat(listener): poll a port multiple times until either "max_poll" or returned "None" #78
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #71
Description
This PR adds a way to poll a
Port
more than once perPort::should_poll
, as the implementation ofPoll::poll
should be non-blocking and returnOk(None)
in the case there is nothing. (though there also exists #77)Because i didnt want to break any existing Ports and because of #77 (and
MockPoll
), i set the defaultmax_poll
to1
(to basically match the behavior of what it was before this PR).This change is necessary, as already explained in #71, if
EnableMouseCapture
is set (incrossterm
, which is the default in 1.9.2), then there are a LOT of events generated very quickly, but before this PR you would only get one event, then wait, then one event, then wait instead of "all" at once. (which can make the TUI very unresponsive)Type of change
Please select relevant options.
Checklist
cargo fmt
cargo clippy
and reports no warningscfg target_os
)Alternative
Alternatively to this PR we could also change the result of
Poll::poll
to return a vec, though i personally would not like to move this aggregation to thePoll
implementation if possible.